'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    const { STRING, INTEGER, DATE, NOW } = Sequelize;
    await queryInterface.createTable('l_video', {
      video_id: { type: INTEGER, primaryKey: true, autoIncrement: true },
      video_title: {
        type: STRING,
        defaultValue: '',
      },
      video_cover: {
        type: STRING,
        defaultValue: '',
      },
      video_url: {
        type: STRING,
        defaultValue: '',
      },
      description: {
        type: STRING,
        defaultValue: '',
      },
      keyword: {
        type: STRING,
        defaultValue: '',
      },
      visited: {
        type: INTEGER,
        defaultValue: 0,
      },
      created_at: {
        type: DATE,
        defaultValue: NOW,
      },
      owner: {
        type: STRING,
        defaultValue: '',
      },
      is_hot: {
        type: INTEGER,
        defaultValue: 0,
      },
    });
  },

  down: async (queryInterface, Sequelize) => {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    await queryInterface.dropTable('l_video');
  },
};
